"""
FastAPI秒杀系统主入口文件
"""

from fastapi import FastAPI
from starlette.middleware.base import BaseHTTPMiddleware
from hooks.middlewares import db_session_middleware
from routers.seckill import router as seckill_router
from routers.order import router as order_router
# 导入路由
# from routers import user, product, seckill

app = FastAPI(
    title="秒杀系统API",
    description="高并发秒杀系统后端API",
    version="1.0.0"
)
app.include_router(seckill_router)
app.include_router(order_router)

# app.add_middleware(
#     BaseHTTPMiddleware,dispatch=db_session_middleware
# )

@app.get("/")
async def root():
    return {"message": "Hello World"}

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(
        "main:app",
        host="0.0.0.0",
        port=8001,
        reload=True
    )
